home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games: Greatest Hits 1996
/
Amiga Games: Greatest Hits 1996.iso
/
archive
/
userbox
/
publicdomain
/
engclock_v7.0.lha
/
EngClock_v7.0
/
EngClock7_Source
/
pub.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-12-01
|
6KB
|
262 lines
/*
* Source machine generated by GadToolsBox V2.0
* which is (c) Copyright 1991-1993 Jaba Development
*
* GUI Designed by : -- Unnamed --
*/
#include <exec/types.h>
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <intuition/classes.h>
#include <intuition/classusr.h>
#include <intuition/imageclass.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
//#include <proto/exec.h>
//#include <proto/intuition.h>
//#include <proto/gadtools.h>
//#include <proto/graphics.h>
//#include <proto/utility.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <clib/exec_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/utility_protos.h>
#include <clib/intuition_protos.h>
extern struct IntuitionBase *IntuitionBase;
extern struct GfxBase *GfxBase;
extern struct Library *UtilityBase;
extern struct Library *GadToolsBase;
extern struct Library *DiskfontBase;
extern struct Library *AslBase;
extern struct Library *IFFParseBase;
extern struct Library *DOSBase;
#include "pub.h"
#define ENGLISH 1
#define FRENCH 2
#define SPANISH 3
char *publister(void);
void adaptpublanguage(void);
extern void msg(char *msg);
extern int language;
BOOL handlegadgets2(ULONG iaddress, ULONG code);
struct IntuiMessage *msg2=NULL;
char *screentitle="Public Screen List";
APTR VisualInfo2 = NULL;
struct Window *Project0Wnd2 = NULL;
struct Gadget *Project0GList2 = NULL;
struct Gadget *Project0Gadgets2[3];
UWORD Project0Left2 = 140;
UWORD Project0Top2 = 27;
UWORD Project0Width2 = 305;
UWORD Project0Height2 = 121;
UBYTE *Project0Wdt2 = (UBYTE *)"EngClock Prefs";
struct TextAttr topaz82 = {
( STRPTR )"topaz.font", 8, 0x00, 0x01 };
UWORD Project0GTypes2[] = {
LISTVIEW_KIND,
BUTTON_KIND,
BUTTON_KIND
};
struct NewGadget Project0NGad2[] = {
23, 14, 252, 85, (UBYTE *)"Public Screens", NULL, GD_PubList, PLACETEXT_ABOVE, NULL, NULL,
6, 104, 85, 13, (UBYTE *)"Ok", NULL, GD_But_Ok, PLACETEXT_IN, NULL, NULL,
205, 104, 85, 13, (UBYTE *)"Cancel", NULL, GD_But_Cancel, PLACETEXT_IN, NULL, NULL
};
ULONG Project0GTags2[] = {
(GTLV_ShowSelected),NULL,(TAG_DONE),
(TAG_DONE),
(TAG_DONE)
};
int SetupScreen2( void )
{
if ( ! ( VisualInfo2 = GetVisualInfo( pubscreen, TAG_DONE )))
return( 2L );
return( 0L );
}
void CloseDownScreen2( void )
{
if ( VisualInfo2 ) {
FreeVisualInfo( VisualInfo2 );
VisualInfo2 = NULL;
}
}
int OpenProject0Window2( void )
{
struct NewGadget ng2;
struct Gadget *g2;
UWORD lc2, tc2;
UWORD offx2 = pubscreen->WBorLeft, offy2 = pubscreen->WBorTop + pubscreen->RastPort.TxHeight + 1;
if ( ! ( g2 = CreateContext( &Project0GList2 )))
return( 1L );
for( lc2 = 0, tc2 = 0; lc2 < Project0_CNT; lc2++ ) {
CopyMem((char * )&Project0NGad2[ lc2 ], (char * )&ng2, (long)sizeof( struct NewGadget ));
ng2.ng_VisualInfo = VisualInfo2;
ng2.ng_TextAttr = &topaz82;
ng2.ng_LeftEdge += offx2;
ng2.ng_TopEdge += offy2;
Project0Gadgets2[ lc2 ] = g2 = CreateGadgetA((ULONG)Project0GTypes2[ lc2 ], g2, &ng2, ( struct TagItem * )&Project0GTags2[ tc2 ] );
while( Project0GTags2[ tc2 ] ) tc2 += 2;
tc2++;
if ( NOT g2 )
return( 2L );
}
if ( ! ( Project0Wnd2 = OpenWindowTags( NULL,
WA_Left, Project0Left2,
WA_Top, Project0Top2,
WA_Width, Project0Width2,
WA_Height, Project0Height2 + offy2,
WA_IDCMP, LISTVIEWIDCMP|BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_DEPTHGADGET|WFLG_ACTIVATE,
WA_Gadgets, Project0GList2,
WA_Title, Project0Wdt2,
WA_ScreenTitle, screentitle,
WA_PubScreen, pubscreen,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( Project0Wnd2, NULL );
return( 0L );
}
void CloseProject0Window2( void )
{
if ( Project0Wnd2 ) {
CloseWindow( Project0Wnd2 );
Project0Wnd2 = NULL;
}
if ( Project0GList2 ) {
FreeGadgets( Project0GList2 );
Project0GList2 = NULL;
}
}
char *publister(void) {
struct List *publist;
ULONG class, code, iaddress;
current=NULL;
adaptpublanguage();
SetupScreen2();
OpenProject0Window2();
publist=LockPubScreenList();
target=AllocMem(sizeof(publist),MEMF_ANY);
CopyMem(publist,target,sizeof(publist));
UnlockPubScreenList();
GT_SetGadgetAttrs(Project0Gadgets2[GD_PubList],Project0Wnd2,NULL,GTLV_Labels,target,TAG_DONE);
GT_RefreshWindow(Project0Wnd2,NULL);
while(1) {
Wait(1<<Project0Wnd2->UserPort->mp_SigBit);
msg2=(struct IntuiMessage *)GT_GetIMsg(Project0Wnd2->UserPort);
class=msg2->Class; code=msg2->Code; iaddress=(ULONG)msg2->IAddress;
GT_ReplyIMsg(msg2);
switch(class) {
case CLOSEWINDOW:
CloseProject0Window2();
CloseDownScreen2();
FreeMem(target,sizeof(target));
return(current);
break;
case GADGETUP:
case GADGETDOWN:
if(handlegadgets2(iaddress,code)) {
FreeMem(target,sizeof(target));
return(current);
}
break;
default:
/* Unknown (internal) msg */
break;
}
}
}
BOOL handlegadgets2(ULONG iaddress, ULONG code) {
struct Gadget *gad;
struct Node *nd;
int i=0;
gad=(struct Gadget *)iaddress;
switch(gad->GadgetID) {
case GD_PubList:
nd=target->lh_Head;
for(i=0; i<code; i++) {
nd=nd->ln_Succ;
}
current=nd->ln_Name;
return(0);
break;
case GD_But_Cancel:
current=(char *)1234; /* Magic returns no! */
CloseProject0Window2();
CloseDownScreen2();
return(1);
break;
case GD_But_Ok:
CloseProject0Window2();
CloseDownScreen2();
return(1);
break;
default:
msg("Unknown gadget!");
break;
}
return(0);
}
void adaptpublanguage(void) {
switch(language) {
case ENGLISH:
break;
case FRENCH:
break;
case SPANISH:
Project0NGad2[0].ng_GadgetText="Pantallas Públicas";
Project0NGad2[2].ng_GadgetText="Cancelar";
screentitle="Lista de Pantallas Públicas";
break;
}
}